package edu.cuit.avatar.collection;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/7/15 11:03
 */
public class Student implements Comparable<Student>{
    private int id;
    private static int nextId = 1;
    private String name;
    private String major;

    public Student(String name, String major) {
        this.id = nextId++;
        this.name = name;
        this.major = major;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    @Override
    public String toString() {
        return id + "    " + name + "    " + major;
    }

    @Override
    public int compareTo(Student o) {
        return id - o.id;
    }
}
